/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	ComponentReflection.h
*
*	Description -	
*
*	Comments	-	
*
*	Modification History:
*			Name			   Date					Description
*			MrCodeSushi	-	06/04/2013	-	Creation of this file
**************************************************************************************/
#ifndef _PSX_COMPONENT_REFLECTION_H_
#define _PSX_COMPONENT_REFLECTION_H_

#include "PulseSTD.h"
#include "IComponent.h"

namespace Pulse
{

	struct CameraReflectionSetting
	{
	public:

		ActorPtr					m_pCamActor;
		Texture2D					*m_pReflectionTexture;
		ParameterShaderResource		*m_pTextureParam;
		RenderEntryBindParameters	*m_pRendererBinderReference;

	};

	class ComponentReflection : public IComponent
	{
	public:

		ComponentReflection( Actor *pOwner );

		virtual ~ComponentReflection( void );

		virtual EErrorCode::Type Initialize( XMLElementPtr pElem );

		virtual const EComponent::Type GetType( void ) const { return EComponent::REFLECTION; }

		virtual const CHAR * GetName( void ) const { return PSX_String("Reflection"); }

		virtual void Update( FLOAT dt );

	private:

		// Delegates
		void OnRender( IEvent *pEvent );

		void OnTransform( IEvent *pEvent );

		void OnModelLoaded( IEvent *pEvent );

		void OnModelUnloaded( IEvent *pEvent );


	private:

		typedef HashTable<const ComponentCamera*, CameraReflectionSetting*> CamRefSettingList;

		CamRefSettingList m_camRefList;
		ComponentModelRenderer *m_pOwnerRenderer;

	};
}

#endif /* _PSX_COMPONENT_REFLECTION_H_ */